package edu.hit.pact.pgse.crawler.bbs;

import java.net.URL;



public class ArticleUpdateInfo implements Comparable<ArticleUpdateInfo>{ 
	private URL homepage;
	private URL lastpage;
	private int pageNum; //we think that one article which has more pages is more important  
	private int priority; //actually ,update frequency
	private String lastModified;
	private int lastPageNum; //the page number last time,compare it and pageNum to calculate the priority 
	private String folderName;
	private int lelfTime;
	
	
	public ArticleUpdateInfo() {
		this.pageNum = 1;
		this.lastPageNum = 1;
		this.priority = 3;
		this.folderName = "";
		this.lastModified = "";
		this.lelfTime = 0;
	}
	

	
	public int getLelfTime() {
		return lelfTime;
	}

	
	public void decreaseLeftTime(){
		this.lelfTime = (this.lelfTime - 1 + this.priority) % this.priority;
	}

    public void upgratePriority(){
    	if(this.priority >= 1){
    		this.priority --;
    	}
    } 
    
    public void downgratePriority(){
    	if(this.priority < 5){
    		this.priority ++;
    	}
    }

	public int getLastPageNum() {
		return lastPageNum;
	}

	public ArticleUpdateInfo build(){
		return new ArticleUpdateInfo();
	}
	
	public String getFolderName() {
		return folderName;
	}


	public void setFolderName(String folderName) {
		this.folderName = folderName;
	}


	public void setLastPageNum(int lastPageNum) {
		this.lastPageNum = lastPageNum;
	}


	public URL getHomepage() {
		return homepage;
	}
	
	public void setHomepage(URL homepage) {
		this.homepage = homepage;
	}
	
	public URL getLastpage() {
		return lastpage;
	}
	
	public void setLastpage(URL lastpage) {
		this.lastpage = lastpage;
	}
	
	public int getPageNum() {
		return pageNum;
	}
	
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}
	public int getPrority() {
		return priority;
	}
	
	public void setPrority(int prority) {
		this.priority = prority;
	}
	
	public String getLastModified() {
		return lastModified;
	}
	
	public void setLastModified(String lastModified) {
		this.lastModified = lastModified;
	}
	
	public void addPageNum(){
		this.pageNum ++;
	}

	@Override
	public int compareTo(ArticleUpdateInfo arg0) {
		
		return 0;
	}

	
	
	
	
	
	

}
